<?php
   $arrayid=$_POST['arrayid'];;
   $id=$_GET['id'];
   
   $connect=mysql_connect("localhost","root","192510");
   mysql_select_db("news",$connect);
   
   
 	if(isset($arrayid[0])){
		 foreach ($arrayid as $id){
		     $get_sql="select * from news where id=$id";
		     $result=mysql_query($get_sql);
		     $row=mysql_fetch_assoc($result);
		     $web=$row["web"];
		     $link=$row["link"];
		     
		     $wenjian=explode("/", $link); 
		     $num=count($wenjian);
		     $rel_wenjian=$wenjian[$num-1];
			 
			 if($web==6){
				 
				 $filename="/var/www/html2/wangzhan/wenjian/$rel_wenjian";
				 unlink($filename);
				 
			 }
		     $sql="delete from news where id=$id";
		     mysql_query($sql);
	    }
     }
	 
   if(isset($id)){
	   $get_sql="select * from news where id=$id";
       $result=mysql_query($get_sql);
       $row=mysql_fetch_assoc($result);
       $web=$row["web"]."网站信息";
       $link=$row["link"];
 
       $wenjian=explode("/", $link); 
       $num=count($wenjian);
       $rel_wenjian=$wenjian[$num-1];
   
	   if($web==6){#需要删除文件的
		    
			$filename="/var/www/html2/wangzhan/wenjian/$rel_wenjian";
			unlink($filename);
			
	   }
	   
	   $sql="delete from news where id=$id";
	   mysql_query($sql);
   }  
     
   echo "<script>location='select_new.php'</script>";
   
   
?>